const Router = require('koa-router')
const updateadvice = new Router()
//！拿到前端的数据
//数据库连接池
const pg = require('pg');
let psql = new pg.Pool({
    database: 'running',
    user: 'run',
    port: 5432,
    host: '82.157.94.115',
    password: 'z12345678',
    max: 2
})

updateadvice.post('/updateadvice', async ctx => {
    let {advise_openid} = ctx.request.body
    let updateContentPostgresql = `update advise set advise_state = '已读' where advise_openid = '${advise_openid}'`;
    let content = await psql.query(updateContentPostgresql);
    if (content.rowCount > 0) {
        
        ctx.body = {
           msg:'更新成功'
        };
    }


})

module.exports = updateadvice